<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>boost/python/str.hpp</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="Boost.Python Reference Manual">
<link rel="up" href="../object_wrappers.html" title="Chapter 3. Object Wrappers">
<link rel="prev" href="boost_python_object_hpp.html" title="boost/python/object.hpp">
<link rel="next" href="boost_python_slice_hpp.html" title="boost/python/slice.hpp">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="" width="" height="" src="../../images/boost.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="boost_python_object_hpp.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../object_wrappers.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="boost_python_slice_hpp.html"><img src="../../images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="object_wrappers.boost_python_str_hpp"></a><a class="link" href="boost_python_str_hpp.html" title="boost/python/str.hpp">boost/python/str.hpp</a>
</h2></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="boost_python_str_hpp.html#object_wrappers.boost_python_str_hpp.introduction">Introduction</a></span></dt>
<dt><span class="section"><a href="boost_python_str_hpp.html#object_wrappers.boost_python_str_hpp.class_str">Class
        <code class="computeroutput"><span class="identifier">str</span></code></a></span></dt>
<dt><span class="section"><a href="boost_python_str_hpp.html#object_wrappers.boost_python_str_hpp.example">Example</a></span></dt>
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="object_wrappers.boost_python_str_hpp.introduction"></a><a class="link" href="boost_python_str_hpp.html#object_wrappers.boost_python_str_hpp.introduction" title="Introduction">Introduction</a>
</h3></div></div></div>
<p>
          Exposes a <a class="link" href="../concepts/objectwrapper.html#concepts.objectwrapper.typewrapper_concept_requirements" title="TypeWrapper Concept Requirements">TypeWrapper</a>
          for the Python <a href="http://www.python.org/dev/doc/devel/lib/string-methods.html" target="_top"><code class="computeroutput"><span class="identifier">str</span></code></a> type.
        </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="object_wrappers.boost_python_str_hpp.class_str"></a><a class="link" href="boost_python_str_hpp.html#object_wrappers.boost_python_str_hpp.class_str" title="Class str">Class
        <code class="computeroutput"><span class="identifier">str</span></code></a>
</h3></div></div></div>
<p>
          Exposes the <a href="http://www.python.org/dev/doc/devel/lib/string-methods.html" target="_top">string
          methods</a> of Python's built-in <code class="computeroutput"><span class="identifier">str</span></code>
          type. The semantics of the constructors and member functions defined below,
          except for the two-argument constructors which construct str objects from
          a range of characters, can be fully understood by reading the <a class="link" href="../concepts/objectwrapper.html#concepts.objectwrapper.typewrapper_concept_requirements" title="TypeWrapper Concept Requirements">TypeWrapper</a>
          concept definition. Since str is publicly derived from <a class="link" href="boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_object" title="Class object"><code class="computeroutput"><span class="identifier">object</span></code></a>, the public <code class="computeroutput"><span class="identifier">object</span></code> interface applies to <code class="computeroutput"><span class="identifier">str</span></code> instances as well.
        </p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">python</span>
<span class="special">{</span>
  <span class="keyword">class</span> <span class="identifier">str</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">object</span>
  <span class="special">{</span>
   <span class="keyword">public</span><span class="special">:</span>
      <span class="identifier">str</span><span class="special">();</span> <span class="comment">// new str</span>

      <span class="identifier">str</span><span class="special">(</span><span class="keyword">char</span> <span class="keyword">const</span><span class="special">*</span> <span class="identifier">s</span><span class="special">);</span> <span class="comment">// new str</span>

      <span class="identifier">str</span><span class="special">(</span><span class="keyword">char</span> <span class="keyword">const</span><span class="special">*</span> <span class="identifier">start</span><span class="special">,</span> <span class="keyword">char</span> <span class="keyword">const</span><span class="special">*</span> <span class="identifier">finish</span><span class="special">);</span> <span class="comment">// new str</span>
      <span class="identifier">str</span><span class="special">(</span><span class="keyword">char</span> <span class="keyword">const</span><span class="special">*</span> <span class="identifier">start</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">length</span><span class="special">);</span> <span class="comment">// new str</span>

      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
      <span class="keyword">explicit</span> <span class="identifier">str</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">other</span><span class="special">);</span>

      <span class="identifier">str</span> <span class="identifier">capitalize</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>

      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
      <span class="identifier">str</span> <span class="identifier">center</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">width</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

      <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
      <span class="keyword">long</span> <span class="identifier">count</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">sub</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">&gt;</span>
      <span class="keyword">long</span> <span class="identifier">count</span><span class="special">(</span><span class="identifier">T1</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">sub</span><span class="special">,</span><span class="identifier">T2</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">start</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span>
      <span class="keyword">long</span> <span class="identifier">count</span><span class="special">(</span><span class="identifier">T1</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">sub</span><span class="special">,</span><span class="identifier">T2</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">start</span><span class="special">,</span> <span class="identifier">T3</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">end</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

      <span class="identifier">object</span> <span class="identifier">decode</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
      <span class="identifier">object</span> <span class="identifier">decode</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">encoding</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">&gt;</span>
      <span class="identifier">object</span> <span class="identifier">decode</span><span class="special">(</span><span class="identifier">T1</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">encoding</span><span class="special">,</span> <span class="identifier">T2</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">errors</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

      <span class="identifier">object</span> <span class="identifier">encode</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
      <span class="identifier">object</span> <span class="identifier">encode</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">encoding</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">&gt;</span>
      <span class="identifier">object</span> <span class="identifier">encode</span><span class="special">(</span><span class="identifier">T1</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">encoding</span><span class="special">,</span> <span class="identifier">T2</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">errors</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
      <span class="keyword">bool</span> <span class="identifier">endswith</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">suffix</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">&gt;</span>
      <span class="keyword">bool</span> <span class="identifier">endswith</span><span class="special">(</span><span class="identifier">T1</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">suffix</span><span class="special">,</span> <span class="identifier">T2</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">start</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span>
      <span class="keyword">bool</span> <span class="identifier">endswith</span><span class="special">(</span><span class="identifier">T1</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">suffix</span><span class="special">,</span> <span class="identifier">T2</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">start</span><span class="special">,</span> <span class="identifier">T3</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">end</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

      <span class="identifier">str</span> <span class="identifier">expandtabs</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
      <span class="identifier">str</span> <span class="identifier">expandtabs</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">tabsize</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
      <span class="keyword">long</span> <span class="identifier">find</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">sub</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">&gt;</span>
      <span class="keyword">long</span> <span class="identifier">find</span><span class="special">(</span><span class="identifier">T1</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">sub</span><span class="special">,</span> <span class="identifier">T2</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">start</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span>
      <span class="keyword">long</span> <span class="identifier">find</span><span class="special">(</span><span class="identifier">T1</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">sub</span><span class="special">,</span> <span class="identifier">T2</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">start</span><span class="special">,</span> <span class="identifier">T3</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">end</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
      <span class="keyword">long</span> <span class="identifier">index</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">sub</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">&gt;</span>
      <span class="keyword">long</span> <span class="identifier">index</span><span class="special">(</span><span class="identifier">T1</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">sub</span><span class="special">,</span> <span class="identifier">T2</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">start</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span>
      <span class="keyword">long</span> <span class="identifier">index</span><span class="special">(</span><span class="identifier">T1</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">sub</span><span class="special">,</span> <span class="identifier">T2</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">start</span><span class="special">,</span> <span class="identifier">T3</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">end</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

      <span class="keyword">bool</span> <span class="identifier">isalnum</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">bool</span> <span class="identifier">isalpha</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">bool</span> <span class="identifier">isdigit</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">bool</span> <span class="identifier">islower</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">bool</span> <span class="identifier">isspace</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">bool</span> <span class="identifier">istitle</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">bool</span> <span class="identifier">isupper</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>

      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
      <span class="identifier">str</span> <span class="identifier">join</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">sequence</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
      <span class="identifier">str</span> <span class="identifier">ljust</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">width</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

      <span class="identifier">str</span> <span class="identifier">lower</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="identifier">str</span> <span class="identifier">lstrip</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>

      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">&gt;</span>
      <span class="identifier">str</span> <span class="identifier">replace</span><span class="special">(</span><span class="identifier">T1</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">old</span><span class="special">,</span> <span class="identifier">T2</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">new_</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span>
      <span class="identifier">str</span> <span class="identifier">replace</span><span class="special">(</span><span class="identifier">T1</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">old</span><span class="special">,</span> <span class="identifier">T2</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">new_</span><span class="special">,</span> <span class="identifier">T3</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">maxsplit</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
      <span class="keyword">long</span> <span class="identifier">rfind</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">sub</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">&gt;</span>
      <span class="keyword">long</span> <span class="identifier">rfind</span><span class="special">(</span><span class="identifier">T1</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">sub</span><span class="special">,</span> <span class="identifier">T2</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">start</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span>
      <span class="keyword">long</span> <span class="identifier">rfind</span><span class="special">(</span><span class="identifier">T1</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">sub</span><span class="special">,</span> <span class="identifier">T2</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">start</span><span class="special">,</span> <span class="identifier">T3</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">end</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
      <span class="keyword">long</span> <span class="identifier">rindex</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">sub</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">&gt;</span>
      <span class="keyword">long</span> <span class="identifier">rindex</span><span class="special">(</span><span class="identifier">T1</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">sub</span><span class="special">,</span> <span class="identifier">T2</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">start</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span>
      <span class="keyword">long</span> <span class="identifier">rindex</span><span class="special">(</span><span class="identifier">T1</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">sub</span><span class="special">,</span> <span class="identifier">T2</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">start</span><span class="special">,</span> <span class="identifier">T3</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">end</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
      <span class="identifier">str</span> <span class="identifier">rjust</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">width</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

      <span class="identifier">str</span> <span class="identifier">rstrip</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>

      <span class="identifier">list</span> <span class="identifier">split</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
      <span class="identifier">list</span> <span class="identifier">split</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">sep</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">&gt;</span>
      <span class="identifier">list</span> <span class="identifier">split</span><span class="special">(</span><span class="identifier">T1</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">sep</span><span class="special">,</span> <span class="identifier">T2</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">maxsplit</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

      <span class="identifier">list</span> <span class="identifier">splitlines</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
      <span class="identifier">list</span> <span class="identifier">splitlines</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">keepends</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
      <span class="keyword">bool</span> <span class="identifier">startswith</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">prefix</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">&gt;</span>
      <span class="keyword">bool</span> <span class="identifier">startswidth</span><span class="special">(</span><span class="identifier">T1</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">prefix</span><span class="special">,</span> <span class="identifier">T2</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">start</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span>
      <span class="keyword">bool</span> <span class="identifier">startswidth</span><span class="special">(</span><span class="identifier">T1</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">prefix</span><span class="special">,</span> <span class="identifier">T2</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">start</span><span class="special">,</span> <span class="identifier">T3</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">end</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

      <span class="identifier">str</span> <span class="identifier">strip</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="identifier">str</span> <span class="identifier">swapcase</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="identifier">str</span> <span class="identifier">title</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>

      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
      <span class="identifier">str</span> <span class="identifier">translate</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">table</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
      <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">&gt;</span>
      <span class="identifier">str</span> <span class="identifier">translate</span><span class="special">(</span><span class="identifier">T1</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">table</span><span class="special">,</span> <span class="identifier">T2</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">deletechars</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

      <span class="identifier">str</span> <span class="identifier">upper</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="special">};</span>
<span class="special">}}</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="object_wrappers.boost_python_str_hpp.example"></a><a class="link" href="boost_python_str_hpp.html#object_wrappers.boost_python_str_hpp.example" title="Example">Example</a>
</h3></div></div></div>
<pre class="programlisting"><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">python</span><span class="special">;</span>
<span class="identifier">str</span> <span class="identifier">remove_angle_brackets</span><span class="special">(</span><span class="identifier">str</span> <span class="identifier">x</span><span class="special">)</span>
<span class="special">{</span>
  <span class="keyword">return</span> <span class="identifier">x</span><span class="special">.</span><span class="identifier">strip</span><span class="special">(</span><span class="char">'&lt;'</span><span class="special">).</span><span class="identifier">strip</span><span class="special">(</span><span class="char">'&gt;'</span><span class="special">);</span>
<span class="special">}</span>
</pre>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2002-2005, 2015 David Abrahams, Stefan Seefeld<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="boost_python_object_hpp.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../object_wrappers.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="boost_python_slice_hpp.html"><img src="../../images/next.png" alt="Next"></a>
</div>
</body>
</html>
